package com.java83.service.impl;

import com.java83.dao.RbacManagerPermDao;
import com.java83.entity.RbacPerm;
import com.java83.service.RbacManagerPermService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (RbacPerm)表服务实现类
 *
 * @author makejava
 * @since 2021-11-26 13:02:43
 */
@Service("rbacManagerPermService")
public class RbacManagerPermServiceImpl implements RbacManagerPermService {
    @Resource
    private RbacManagerPermDao rbacManagerPermDao;

    /**
     * 通过ID查询单条数据
     *
     * @param managerId 主键
     * @return 实例对象
     */
    @Override
    public RbacPerm queryById(Integer managerId) {
        return this.rbacManagerPermDao.queryById(managerId);
    }

    /**
     * 分页查询
     *
     * @return 查询结果
     */
    @Override
    public List<RbacPerm> queryAll() {
        return rbacManagerPermDao.qureyAll();
    }

    /**
     * 新增数据
     *
     * @param rbacManagerPerm 实例对象
     * @return 实例对象
     */
    @Override
    public RbacPerm insert(RbacPerm rbacManagerPerm) {
        this.rbacManagerPermDao.insert(rbacManagerPerm);
        return rbacManagerPerm;
    }

    /**
     * 修改数据
     *
     * @param rbacManagerPerm 实例对象
     * @return 实例对象
     */
    @Override
    public RbacPerm update(RbacPerm rbacManagerPerm) {
        this.rbacManagerPermDao.update(rbacManagerPerm);
        return this.queryById(rbacManagerPerm.getManagerId());
    }

    /**
     * 通过主键删除数据
     *
     * @param managerId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer managerId) {
        return this.rbacManagerPermDao.deleteById(managerId) > 0;
    }


}
